#include "server.hpp"
#include <functional>
#include <queue>
#include <string>
#include <unistd.h>
#include <queue>
#include <set>
#include <vector>
using namespace std;
int main() { 
    // Buffer buf;
    // std::string str = "hello";
    // buf.WriteStringAndPush(str);
    // Buffer buf1;
    // buf1.WriteBufferAndPush(buf);
    // std::string temp;
    // temp = buf1.ReadAsStringAndPop(buf1.ReadAbleSize());
    // cout << temp << endl;
    // cout << buf.ReadAbleSize() << endl;
    // cout << buf1.ReadAbleSize() << endl;
    Buffer buf;
    for(int i = 0; i < 300; i++) {
        std::string str = "hello" + std::to_string(i) + '\n';
        buf.WriteStringAndPush(str);
    }
    while(buf.ReadAbleSize() > 0) {
        string line = buf.GetLinePop();
        cout << line << endl;
        sleep(1);
    }
    return 0;
}

